<template>
  <div class="home">
    <h2>系统拓扑图示例</h2>
    <div class="topology-list">
      <el-card v-for="item in topologyList" :key="item.path" class="topology-card" @click="goToTopology(item.path)">
        <template #header>
          <div class="card-header">
            <span>{{ item.name }}</span>
            <el-button class="button" text>
              <el-icon><ArrowRight /></el-icon>
            </el-button>
          </div>
        </template>
        <div class="card-description">{{ item.description }}</div>
      </el-card>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { ArrowRight } from '@element-plus/icons-vue'

const router = useRouter()

const topologyList = [
  {
    name: '微服务架构',
    path: '/microservice',
    description: '展示完整的微服务系统架构，包含服务网关、认证、用户服务等组件'
  },
  {
    name: '云平台架构',
    path: '/cloud',
    description: '展示云计算平台架构，包含IaaS、PaaS、SaaS等层级'
  },
  {
    name: '大数据平台',
    path: '/bigdata',
    description: '展示大数据处理平台架构，包含数据采集、存储、计算等模块'
  }
]

const goToTopology = (path) => {
  router.push(path)
}
</script>

<style scoped>
.home {
  padding: 20px;
}

.topology-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.topology-card {
  cursor: pointer;
  transition: all 0.3s;
}

.topology-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-description {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}
</style>
